<?php
require($_SERVER['DOCUMENT_ROOT'].'/wordpress/wp-blog-header.php' );

$METHOD = $_POST;

function processRequest($data)
{
	global $wpdb;
	$action = strtolower($data['action']);
	
	if(!strcmp($action,'reset'))
	{
		getDefaultPlacesFormData($data);
	}
	else if(!strcmp($action,'newplace'))
	{
		getNewPlaceFormData($data);
	}
	else if(!strcmp($action,'newplacedata'))
	{
		if(		!isset($data['nombre'])
			||	!isset($data['ciudad'])
			||	!isset($data['pais'])
		)
		{
			getDefaultError();
		}
		else
		{
			insertNewPlace($data);
		}
	}
	else if(!strcmp($action,'getdata'))
	{
		getReadOnlyFormFor($data);
	}
	else if(!strcmp($action,'edit'))
	{
		getFormForEdit($data);
	}
	else if(!strcmp($action,'updatedata'))
	{
		updateData($data);
		getReadOnlyFormFor($data);
	}
}

processRequest($METHOD);

 ?>